import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import axios from "axios";
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import "./assets/style/reset.css";
import tableTitle from "./components/tableTitle.vue";
import * as echarts from "echarts";
Vue.config.productionTip = false;
// 导入ecahrts 挂载到原型
Vue.prototype.$axios = axios;
Vue.prototype.$echarts = echarts;
Vue.prototype.$bus = new Vue({});
// 注册全局组件
Vue.component("tableTitle", tableTitle);

// 自定义指令

Vue.directive("power", {
  bind() {},
  inserted(el, binding) {
    console.log(binding.value);
    if (store.state.powerCode == "2") {
      console.log(el);
      // 添加class
      el.classList.add("is-disabled");
    }
  },
  update() {},
});

import {
  Upload,
  Row,
  Col,
  Button,
  Menu,
  MenuItem,
  MenuItemGroup,
  Submenu,
  MessageBox,
  Notification,
  Message,
  Breadcrumb,
  BreadcrumbItem,
  Form,
  FormItem,
  Input,
  Link,
  Dialog,
  Select,
  Option,
  Table,
  TableColumn,
  Pagination,
  DatePicker,
} from "element-ui";
Vue.use(Upload);
Vue.use(DatePicker);
Vue.use(Dialog);
Vue.use(Pagination);
Vue.use(Table);
Vue.use(TableColumn);
Vue.use(Select);
Vue.use(Option);
Vue.use(Link);
Vue.use(Form);
Vue.use(FormItem);
Vue.use(Input);
Vue.use(Breadcrumb);
Vue.use(BreadcrumbItem);
Vue.use(Button);
Vue.use(Row);
Vue.use(Col);
Vue.use(Menu);
Vue.use(MenuItem);
Vue.use(MenuItemGroup);
Vue.use(Submenu);

console.log(process.env.NODE_ENV);
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;
Vue.prototype.$confirm = MessageBox.confirm;
Vue.prototype.$prompt = MessageBox.prompt;
Vue.prototype.$notify = Notification;
Vue.prototype.$message = Message;
new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");
